package util;

import lombok.Data;

@Data
public class Result <T>{
    private String code;//状态码
    private String msg;//消息
    private T Data;//数据
    private Integer count;//总条数

    public Result() {
    }

    public Result(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Result(String code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        Data = data;
    }

    public Result(String code, String msg, T data, Integer count) {
        this.code = code;
        this.msg = msg;
        Data = data;
        this.count = count;
    }

    public Result<T> ok(){
        return new Result("200","操作成功！");
    }

    public Result<T> fail(){
        return new Result("500","服务器异常！");
    }


}
